package com.ihealthway.all.groupbuy.vo;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.lang.Lang;
import org.nutz.log.Log;
import org.nutz.log.Logs;

import java.io.Serializable;
import java.util.Date;

/**
 * Bean class for system admin design
 * @author  凡梦星尘(elkan1788@gmail.com)
 */
@Table("gb_sysadmin")
public class SysAdmin implements Serializable,Cloneable {

    private static final Log logger = Logs.get();

    @Id
    @Column("sa_id")
    private Integer adminId;
    @Column("account")
    private String account;
    @Column("passwd")
    private String passwd;
    @Column("email")
    private String email;
    @Column("nick_name")
    private String nickName;
    @Column("ip_addr")
    private String ipAddr;
    @Column("login_cnt")
    private Integer loginCnt;
    @Column("remarks")
    private String remarks;
    @Column("create_time")
    private Date createTime;
    @Column("update_time")
    private Date updateTime;
    @Column("data_status")
    private String dataStatus;

    public Integer getAdminId() {
        return adminId;
    }

    public void setAdminId(Integer adminId) {
        this.adminId = adminId;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPasswd() {
        return passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public Integer getLoginCnt() {
        return loginCnt;
    }

    public void setLoginCnt(Integer loginCnt) {
        this.loginCnt = loginCnt;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getDataStatus() {
        return dataStatus;
    }

    public void setDataStatus(String dataStatus) {
        this.dataStatus = dataStatus;
    }

    public boolean validPasswd(String sourcePswd) {
        return Lang.md5(sourcePswd).equals(this.passwd);
    }

    @Override
    public Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            logger.error("Clone system admin object failed.", e);
            return null;
        }
    }

    @Override
    public String toString() {
        return "SysAdmin{" +
                "adminId=" + adminId +
                ", account='" + account + '\'' +
                ", passwd='" + passwd + '\'' +
                ", email='" + email + '\'' +
                ", nickName='" + nickName + '\'' +
                ", ipAddr='" + ipAddr + '\'' +
                ", loginCnt=" + loginCnt +
                ", remarks='" + remarks + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", dataStatus='" + dataStatus + '\'' +
                '}';
    }
}
